#!/bin/sh
. /lib/functions.sh

_set_fsck() {
	uci -q batch <<-EOF >/dev/null
		set "fstab.$1.enabled=1"
		set "fstab.$1.enabled_fsck=1"
	EOF
}

[ -z "$(uci show fstab | grep mount)" ] && /sbin/block detect > /etc/config/fstab
uci -q set fstab.@global[0].check_fs='1'
config_load fstab
config_foreach _set_fsck mount
uci -q commit fstab

exit 0
